<template>
  <div class="protected-container">
    <h1>受保护页面</h1>
    <el-button type="danger" @click="handleLogout">退出登录</el-button>
  </div>
</template>

<script setup>
import { useStore } from 'vuex';
import { useRouter } from 'vue-router';

const store = useStore();
const router = useRouter();

const handleLogout = () => {
  store.dispatch('logout');
  router.push('/');
};
</script>

<style scoped>
.protected-container {
  max-width: 600px;
  margin: 100px auto;
  padding: 20px;
  text-align: center;
}
</style>